package com.chatcompetition.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chatcompetition.domain.entity.Document;
import com.chatcompetition.mapper.DocumentsMapper;
import com.chatcompetition.service.DocumentsService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Document> implements DocumentsService {

    @Override
    public Document createDocument(Document document) {
        save(document);
        return document;
    }

    @Override
    public Document getDocumentById(Long id) {
        return getById(id);
    }

    @Override
    public List<Document> getAllDocuments() {
        return list();
    }

    @Override
    public Void updateDocument(Document document) {
        updateById(document);

        return null;
    }

    @Override
    public void deleteDocument(Long id) {
        removeById(id);
    }
}